package com.no.hq.controller;

import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RestController
@Slf4j
@RequestMapping("/web")
public class WebController {

    @RequestMapping("demo1")
    public String demo1(@RequestParam Integer id, @RequestParam String name) {
        log.debug("从请求中获取到请求参数：id -> " + id + "; name -> " + name);
        return "看到我，就成功了。";
    }

    @RequestMapping("demo2/{id}")
    public String demo2(@PathVariable Integer id) {
        log.info("从动态路径中获取到id的值 -> " + id);
        return "随便写吧";
    }
}
